# encoding: utf-8
class LocationsController < ApplicationController
  before_filter :login_required
  
  # locations_controller method that returns the ajax search results in json format
  #
  def search
    @results = Location.search(params[:term])
    
    respond_to do |format|
      format.json do
        @results.map! do |loc|
          {
            :value => loc.name
          }
        end
        render :json => @results
      end
    end
  end
end